import request from "@/utils/request"

// 查询品牌列表
// 请求参数类型
export interface reqTrademarkListParamsType {
  page: number,
  limit: number
}
// 返回值类型
export interface reqTrademarkReturnItemType {
  id: number
  tmName: string
  logoUrl: string
}
export type reqTrademarkReturnRecordsType = reqTrademarkReturnItemType[]
export interface reqTrademarkReturnType {
  records: reqTrademarkReturnRecordsType,
  total: number,
  size: number,
  current: number,
  searchCount: boolean,
  pages: number
}
export const requestTrademarkList = ({ page, limit }: reqTrademarkListParamsType) => {
  return request.get<any, reqTrademarkReturnType>(`/admin/product/baseTrademark/${page}/${limit}`)
}

// 修改品牌
export const requestUpdateTrademarkList = (trademark: reqTrademarkReturnItemType) => {
  return request.put<any, null>(`/admin/product/baseTrademark/update`, trademark)
}

// 删除品牌
export const requestDeleteTrademarkList = (id: number) => {
  return request.delete<any, null>(`/admin/product/baseTrademark/remove/${id}`)
}

// 新增品牌
export interface reqAddTradeParamsType {
  tmName: string
  logoUrl: string
}
export const requestPutTrademarkList = (trademark: reqAddTradeParamsType) => {
  return request.post<any, null>(`/admin/product/baseTrademark/save`, trademark)
}

// 获取所有品牌列表
export interface requestAllTmListReturnType {
  id: number,
  tmName: string,
  logoUrl: string
}

export const requestAllTmList = () => {
  return request.get<any, requestAllTmListReturnType[]>(`/admin/product/baseTrademark/getTrademarkList`)
}


